<?php
//配合ajax_ld.html查询联动数据
$pid = $_POST["pid"];
$cid = $_POST["cid"];
$pdo = new PDO("mysql:host=127.0.0.1;dbname=multiple","root","keyan");
$pdo->exec("set names utf8");
if($pid==null && $cid==null){
	$sql = "select * from province ";
}elseif($pid!=null && $cid==null){
	$sql = "select * from city where pid = $pid";
}elseif($pid==null && $cid!=null){
	$sql = "select * from village where cid = $cid";
}
$pdos= $pdo->query($sql);
$arr = $pdos->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($arr);